package com.lgx.mall.business.dao.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Component;

import com.lgx.common.basic.dao.GeneralDao;
import com.lgx.common.web.Pagination;
import com.lgx.mall.business.dao.IRebateDao;

/**
 * 返利dao实现
 * @author Administrator
 *
 */
@Component
public class RebateDao extends GeneralDao implements IRebateDao{

	/**
	 * 分页查询
	 */
	@Override
	public Pagination findRebatePagination(String rebateStarTime,
			String rebateEndTime, int pageSize, int pageNum) {
		String sql = "select r from Rebate r where 1=1";
		
		if(!StringUtils.isEmpty(rebateStarTime) && !StringUtils.isEmpty(rebateEndTime)){
			sql += "  and r.rebateTime >="+rebateStarTime+" and r.rebateTime <="+rebateEndTime;
		}
		
		sql += " order by r.rebateTime desc";
		return this.getListPagination(sql, new Object[]{}, pageSize, pageNum);
	}

}
